.class public Lcom/mime/qweibo/utils/QHttpUtil;
.super Ljava/lang/Object;
.source "QHttpUtil.java"


# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 12
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static formParamDecode(Ljava/lang/String;)Ljava/lang/String;
    .locals 12
    .parameter "value"

    .prologue
    const/16 v11, 0x25

    .line 67
    const/4 v6, 0x0

    .line 68
    .local v6, nCount:I
    const/4 v3, 0x0

    .local v3, i:I
    :goto_0
    invoke-virtual {p0}, Ljava/lang/String;->length()I

    move-result v9

    if-lt v3, v9, :cond_0

    .line 75
    new-array v8, v6, [B

    .line 77
    .local v8, sb:[B
    const/4 v3, 0x0

    const/4 v4, 0x0

    .local v4, index:I
    :goto_1
    invoke-virtual {p0}, Ljava/lang/String;->length()I

    move-result v9

    if-lt v3, v9, :cond_2

    .line 88
    const-string v0, ""

    .line 90
    .local v0, decode:Ljava/lang/String;
    :try_start_0
    new-instance v1, Ljava/lang/String;

    const-string v9, "UTF-8"

    invoke-direct {v1, v8, v9}, Ljava/lang/String;-><init>([BLjava/lang/String;)V
    :try_end_0
    .catch Ljava/io/UnsupportedEncodingException; {:try_start_0 .. :try_end_0} :catch_0

    .end local v0           #decode:Ljava/lang/String;
    .local v1, decode:Ljava/lang/String;
    move-object v0, v1

    .line 94
    .end local v1           #decode:Ljava/lang/String;
    .restart local v0       #decode:Ljava/lang/String;
    :goto_2
    return-object v0

    .line 69
    .end local v0           #decode:Ljava/lang/String;
    .end local v4           #index:I
    .end local v8           #sb:[B
    :cond_0
    invoke-virtual {p0, v3}, Ljava/lang/String;->charAt(I)C

    move-result v9

    if-ne v9, v11, :cond_1

    .line 70
    add-int/lit8 v3, v3, 0x2

    .line 72
    :cond_1
    add-int/lit8 v6, v6, 0x1

    .line 68
    add-int/lit8 v3, v3, 0x1

    goto :goto_0

    .line 78
    .restart local v4       #index:I
    .restart local v8       #sb:[B
    :cond_2
    invoke-virtual {p0, v3}, Ljava/lang/String;->charAt(I)C

    move-result v9

    if-eq v9, v11, :cond_3

    .line 79
    add-int/lit8 v5, v4, 0x1

    .end local v4           #index:I
    .local v5, index:I
    invoke-virtual {p0, v3}, Ljava/lang/String;->charAt(I)C

    move-result v9

    int-to-byte v9, v9

    aput-byte v9, v8, v4

    move v4, v5

    .line 77
    .end local v5           #index:I
    .restart local v4       #index:I
    :goto_3
    add-int/lit8 v3, v3, 0x1

    goto :goto_1

    .line 81
    :cond_3
    new-instance v7, Ljava/lang/StringBuilder;

    invoke-direct {v7}, Ljava/lang/StringBuilder;-><init>()V

    .line 82
    .local v7, sChar:Ljava/lang/StringBuilder;
    add-int/lit8 v9, v3, 0x1

    invoke-virtual {p0, v9}, Ljava/lang/String;->charAt(I)C

    move-result v9

    invoke-virtual {v7, v9}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    .line 83
    add-int/lit8 v9, v3, 0x2

    invoke-virtual {p0, v9}, Ljava/lang/String;->charAt(I)C

    move-result v9

    invoke-virtual {v7, v9}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    .line 84
    add-int/lit8 v5, v4, 0x1

    .end local v4           #index:I
    .restart local v5       #index:I
    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v9

    const/16 v10, 0x10

    invoke-static {v9, v10}, Ljava/lang/Integer;->valueOf(Ljava/lang/String;I)Ljava/lang/Integer;

    move-result-object v9

    invoke-virtual {v9}, Ljava/lang/Integer;->byteValue()B

    move-result v9

    aput-byte v9, v8, v4

    .line 85
    add-int/lit8 v3, v3, 0x2

    move v4, v5

    .end local v5           #index:I
    .restart local v4       #index:I
    goto :goto_3

    .line 91
    .end local v7           #sChar:Ljava/lang/StringBuilder;
    .restart local v0       #decode:Ljava/lang/String;
    :catch_0
    move-exception v2

    .line 92
    .local v2, e:Ljava/io/UnsupportedEncodingException;
    invoke-virtual {v2}, Ljava/io/UnsupportedEncodingException;->printStackTrace()V

    goto :goto_2
.end method

.method public static getContentType(Ljava/io/File;)Ljava/lang/String;
    .locals 1
    .parameter "file"

    .prologue
    .line 30
    new-instance v0, Ljavax/activation/MimetypesFileTypeMap;

    invoke-direct {v0}, Ljavax/activation/MimetypesFileTypeMap;-><init>()V

    invoke-virtual {v0, p0}, Ljavax/activation/MimetypesFileTypeMap;->getContentType(Ljava/io/File;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public static getContentType(Ljava/lang/String;)Ljava/lang/String;
    .locals 1
    .parameter "fileName"

    .prologue
    .line 21
    new-instance v0, Ljavax/activation/MimetypesFileTypeMap;

    invoke-direct {v0}, Ljavax/activation/MimetypesFileTypeMap;-><init>()V

    invoke-virtual {v0, p0}, Ljavax/activation/MimetypesFileTypeMap;->getContentType(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public static getQueryParameters(Ljava/lang/String;)Ljava/util/List;
    .locals 11
    .parameter "queryString"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/String;",
            ")",
            "Ljava/util/List",
            "<",
            "Lcom/mime/qweibo/QParameter;",
            ">;"
        }
    .end annotation

    .prologue
    const/4 v10, 0x1

    const/4 v5, 0x0

    .line 39
    const-string v4, "?"

    invoke-virtual {p0, v4}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v4

    if-eqz v4, :cond_0

    .line 40
    invoke-virtual {p0, v10}, Ljava/lang/String;->substring(I)Ljava/lang/String;

    move-result-object p0

    .line 43
    :cond_0
    new-instance v1, Ljava/util/ArrayList;

    invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V

    .line 45
    .local v1, result:Ljava/util/List;,"Ljava/util/List<Lcom/mime/qweibo/QParameter;>;"
    if-eqz p0, :cond_1

    const-string v4, ""

    invoke-virtual {p0, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-nez v4, :cond_1

    .line 46
    const-string v4, "&"

    invoke-virtual {p0, v4}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;

    move-result-object v0

    .line 47
    .local v0, p:[Ljava/lang/String;
    array-length v6, v0

    move v4, v5

    :goto_0
    if-lt v4, v6, :cond_2

    .line 57
    .end local v0           #p:[Ljava/lang/String;
    :cond_1
    return-object v1

    .line 47
    .restart local v0       #p:[Ljava/lang/String;
    :cond_2
    aget-object v2, v0, v4

    .line 48
    .local v2, s:Ljava/lang/String;
    if-eqz v2, :cond_3

    const-string v7, ""

    invoke-virtual {v2, v7}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v7

    if-nez v7, :cond_3

    .line 49
    const/16 v7, 0x3d

    invoke-virtual {v2, v7}, Ljava/lang/String;->indexOf(I)I

    move-result v7

    const/4 v8, -0x1

    if-le v7, v8, :cond_3

    .line 50
    const-string v7, "="

    invoke-virtual {v2, v7}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;

    move-result-object v3

    .line 51
    .local v3, temp:[Ljava/lang/String;
    new-instance v7, Lcom/mime/qweibo/QParameter;

    aget-object v8, v3, v5

    aget-object v9, v3, v10

    invoke-direct {v7, v8, v9}, Lcom/mime/qweibo/QParameter;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    invoke-interface {v1, v7}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 47
    .end local v3           #temp:[Ljava/lang/String;
    :cond_3
    add-int/lit8 v4, v4, 0x1

    goto :goto_0
.end method
